package com.fengmi;

import org.mybatis.spring.annotation.MapperScan;
import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;

@SpringBootApplication
@EnableDiscoveryClient
@EnableScheduling
@MapperScan(basePackages = {"com.fengmi.miaosha.mapper"})
public class MiaoshaApp {
    public static void main(String[] args) {
        SpringApplication.run(MiaoshaApp.class,args);
    }


    //初始化redisson客户端
    @Bean
    public RedissonClient redissonClient(){

        Config config = new Config();
        config.setLockWatchdogTimeout(100);
        config.useSingleServer().setAddress("redis://192.168.25.130:6379").setPassword("123456");


        RedissonClient redissonClient = Redisson.create(config);


        return redissonClient;

    }
}
